#include<stdio.h>
/**
 * 示例说明：本例说明了结构体的用法，以及如何访问结构体中的成员变量。
*/
struct Date
{
    int year;
    int month;
    int day;
};

struct Book
{
    char title[50];
    char author[50];
    float price;
    struct Date date;
};

struct Book getInput(struct Book book);
void printbook(struct Book book);
struct Book getInput(struct Book book)
{
    printf("请输入书名:");
    scanf("%s",book.title);
    printf("请输入作者：");
    scanf("%s",book.author);
    printf("请输入价格");
    scanf("%f",&book.price);
    printf("请输入日期");
    scanf("%d-%d-%d",&book.date.year,&book.date.month,&book.date.day);
    return book;
}

void printbook(struct Book book)
{
    printf("******************************");
    printf("书名：%s\n",book.title);
    printf("作者：%s\n",book.author);
    printf("价格：%f\n",book.price);
    printf("日期：%d-%d-%d\n",book.date.year,book.date.month,book.date.day);
    printf("******************************\n");

}

int main(void)
{
    struct Book b1;
    printf("请输入第一本书的信息...\n");
    b1 = getInput(b1);
    printbook(b1);
    return 0;

}